package com.liangzhong.modules.match.command
{
	import com.common.utils.Debug;
	import com.liangzhong.constants.ApplicationConstants;
	import com.liangzhong.model.AppData;
	import com.liangzhong.model.match.EventDes;
	import com.liangzhong.model.match.GameDes;
	import com.liangzhong.model.match.GameDes_Status;
	import com.liangzhong.model.match.GameStart;
	import com.liangzhong.model.match.ShootBall_S;
	import com.liangzhong.modules.match.mediator.MatchMediator;
	import com.liangzhong.proxy.match.MatchProxy;
	
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	
	public class MatchCommand extends SimpleCommand
	{
		public function MatchCommand()
		{
			super();
		}
		override public function execute(notification:INotification):void
		{
			var matchProxy :MatchProxy = facade.retrieveProxy(MatchProxy.ProxyName) as MatchProxy;
			var userId :int = AppData.getInstance().user.uid;
			switch(notification.getName())
			{
				case ApplicationConstants.Match_LoadRes_Complete://资源加载完成
				{
					matchProxy.loadResComplete(notification.getBody());
					Debug.echo("Match --> Match_LoadRes_Complete req ",Debug.TRACER);
					break;
				}
				case MatchProxy.GameStart_Result://比赛开始结果
				{
					var gameStart :GameStart = GameStart(notification.getBody());
					Debug.echo("Match --> Game Start res",Debug.TRACER);
					Debug.echo(gameStart,Debug.TRACER);
					//this.sendNotification(MatchMediator.GameStart_Result,gameStart);
					break;
				}
				case MatchProxy.GameDes_Event_Result://比赛事件
				{
					var eventDes :EventDes = notification.getBody() as EventDes;
					Debug.echo("Match --> Game Event res",Debug.TRACER);
					Debug.echo(eventDes,Debug.TRACER);
					//this.sendNotification(MatchMediator.GameEvnet_Result,eventDes);
					break;
				}
				case MatchProxy.GameDes_Status_Result://游戏状态
				{
					var gameDes_Status :GameDes_Status = GameDes_Status(notification.getBody());
					Debug.echo("Match --> Game Des Status res",Debug.TRACER);
					Debug.echo(gameDes_Status,Debug.TRACER);
					//this.sendNotification(MatchMediator.GameDes_Result_Status_Success,gameDes_Status);
					break;
				}
				case MatchProxy.GameDes_Result://游戏描述
				{
					var gameDes :GameDes = GameDes(notification.getBody());
					//Debug.echo("Match --> Game Des res",Debug.TRACER);
					//Debug.echo(gameDes,Debug.TRACER);
					//this.sendNotification(MatchMediator.GameDes_Result_Success,gameDes);
					break;
				}
				case ApplicationConstants.Match_ShootBall://射门请求
				{
					matchProxy.shootBallReq(notification.getBody());
					Debug.echo("Match --> shoot ball req",Debug.TRACER);
					break;
				}
				case MatchProxy.ShootBall_Result://射门结果
				{
					var shootBall_S :ShootBall_S = notification.getBody() as ShootBall_S;
					Debug.echo("Match --> shoot ball res",Debug.TRACER);
					Debug.echo(shootBall_S,Debug.TRACER);
					//this.sendNotification(MatchMediator.ShootBall_Result_Success,shootBall_S);
					break;
				}
				case ApplicationConstants.Match_SelectTactics://选择战术
				{
					matchProxy.selectTactics(notification.getBody());
					break;
				}
				case MatchProxy.SelectTactics_Result://选择战术结果
				{
					//this.sendNotification(MatchMediator.SelectTactics_Result_Success,notification.getBody());
					break;
				}
				case ApplicationConstants.Match_AdjustPlace://调整位置
				{
					matchProxy.adjustPlace(notification.getBody());
					break;
				}
				case MatchProxy.AdjustPlace_Result://调整位置 res
				{
					//this.sendNotification(MatchMediator.AdjustPlace_Result_Success,notification.getBody());
					break;
				}
				case MatchProxy.GameEnd_Result://比赛结束
				{
					var gameEndVo :Object = notification.getBody();
					Debug.echo("Match --> game result res",Debug.TRACER);
					Debug.echo(gameEndVo,Debug.TRACER);
					//this.sendNotification(MatchMediator.GameEnd_Result,gameEndVo);
					break;
				}
				case MatchProxy.PlayerSaying_Result://球员说话
				{
					//this.sendNotification(MatchMediator.PlayerSaying_Result,notification.getBody());
					break;
				}
				case ApplicationConstants.Match_Chat://聊天
				{
					matchProxy.chat(notification.getBody());
					break;
				}
				case ApplicationConstants.Match_Slide://铲球
				{
					matchProxy.slide(notification.getBody());
					break;
				}
				case ApplicationConstants.Match_Cross://突破
				{
					matchProxy.cross(notification.getBody());
					break;
				}
			}
		}
	}
}